/**
 * Created by Fesine on 2016/2/24.
 */
var application;

Ext.Loader.setConfig({
    enabled: true
});

Ext.require('Ext.app.Application', function () {
    Ext.app.Application.addMembers({
        //加载Controller后触发事件
        newControllerAdded: function (idx, cntr) {
            cntr.init(this);
        },
        //判断是否已加载指定Controller，返回Boolean
        hasController: function (name) {
            return !!this.controllers.get(name);
        },
        //加载并返回指定Controller
        addController: function (name) {
            return this.getController(name);
        }
    });
});

Ext.onReady(function () {

    /**开启ext自动提示*/
    Ext.QuickTips.init();

    /**主程序开始*/
    application = new  Ext.application({
        name: 'core',//命名空间
        appFolder: 'core/coreApp',
        launch: function () {
            Ext.tip.QuickTipManager.init();
            this.controllers.addListener('add', this.newControllerAdded, this);

            Ext.create("Ext.container.Viewport",{
                layout:'fit',
                border:0,
                items:[{
                    xtype: "mainviewlayout"
                }]
            });
        },
        // autoCreateViewport: true,
        controllers: ["core.app.controller.MainController"]

    });
});
